import logging
from logging import Logger


class LogSS(object):
    """
    日志服务
    """
    __logger: Logger = Logger(__name__, level=logging.DEBUG)

    __instance = None

    def __new__(cls, *args, **kwargs):
        if not cls.__instance:
            cls.__instance = super().__new__(cls, *args, **kwargs)
        return cls.__instance

    @staticmethod
    def set_logger(logger: Logger):
        """
        设置Logger
        :param logger:
        :return:
        """
        LogSS.__logger = logger

    def __call__(self, *args, **kwargs) -> Logger:
        return self.__logger


LogS = LogSS()()


__all__ = ['LogS', 'LogSS']
